package main

import "sort"

func findSpecialInteger(arr []int) int {
	i := 0
	for i < len(arr) {
		start := sort.Search(len(arr), func(j int) bool {
			return arr[j] >= arr[i]
		})
		end := sort.Search(len(arr), func(j int) bool {
			return arr[j] > arr[i]
		})
		if (end - start) * 4 > len(arr) {
			return arr[i]
		}
		i = end
	}
	return -1
}

func main() {
	res := findSpecialInteger([]int{1,2,3,3})
	println(res)
}
